//path.join 方法,可以把多个路径片段拼接位完整的路径字符串
const path = require('path');
const fs = require('fs');


//注意：../会抵消前面的路径
const pathStr = path.join('/a', '/b/c', '../', ',/d', 'e');
console.log(pathStr);// \a\b\d\e

fs.readFile(path.join(__dirname, './成绩.txt'), 'utf-8', (err, dataStr) => {
    if (err) {
        console.log('读取文件失败' + err.message);
    }
    console.log('读取文件成功' + dataStr);
})

